import { useResponseSuccess } from '~/utils/response';

export default eventHandler(async (event) => {
  const templateId = getRouterParam(event, 'id');

  // 模拟模板版本数据
  const versions = [
    {
      id: '1',
      templateId: templateId,
      version: '1.0.0',
      description: '初始版本',
      changes: '创建模板基础配置',
      status: 'ACTIVE',
      createTime: '2024-01-15 10:30:00',
      createBy: 'admin',
    },
    {
      id: '2',
      templateId: templateId,
      version: '1.1.0',
      description: '增加容量配置',
      changes: '新增容量限制和预警设置',
      status: 'ACTIVE',
      createTime: '2024-01-16 14:20:00',
      createBy: 'admin',
    },
    {
      id: '3',
      templateId: templateId,
      version: '1.2.0',
      description: '优化调度规则',
      changes: '更新调度算法，提高资源利用率',
      status: 'INACTIVE',
      createTime: '2024-01-17 09:15:00',
      createBy: 'admin',
    },
  ];

  return useResponseSuccess({
    items: versions,
    total: versions.length,
  });
});
